# -*-coding:utf-8 -*-

"""
将txt中的港资机构进行转换输出csv
创建三个字段：
id，code_ ,name_
"""
import pandas as pd
import numpy as np


def read_txt(file,columns):
    df=pd.read_csv(file,sep="\t",encoding='utf-8',header=None,names=columns,index_col=None)
    return df

if __name__ == '__main__':
    columns=["name_"]
    file="./name.txt"
    outfile="./name_20210324.csv"
    df=read_txt(file,columns)
    #插入数据
    df.insert(0,"code_",["HKINS_"+str(x+1)  for x in range(len(df))])
    df.to_csv(outfile,index_label='index_')
    # print(df)